﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Reflection;
using System.Text;
using com.tencent.pandora.MiniJSON;
using UIFrameWork;
//using MiniJSON;
using UnityEngine;
using Debug = UnityEngine.Debug;

public class NewBehaviourScript : MonoBehaviour
{
	public TextAsset TextAsset;
	// Use this for initialization
	void Start () {
//		FileStream fs = new FileStream(Application.dataPath+"/NewBehaviourScript.cs", FileMode.Open);
//		System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
//		byte[] retVal = md5.ComputeHash(fs);
//		
//		fs.Close();
//
//		StringBuilder sb = new StringBuilder();
//		for (int i = 0; i < retVal.Length; i++)
//		{
//			Debug.Log(retVal[i]);
//			Debug.Log(retVal[i].ToString("x2"));
//			sb.Append(retVal[i].ToString("x2"));
//		}
//		StackTrace stackTrace = new StackTrace(0, true);
//		int result = stackTrace.GetFrame(0).GetFileLineNumber();
//		Debug.Log( result.ToString());
		
//		System.Diagnostics.Debug.WriteLine(new string('*', 78));
//		System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace();
//		System.Diagnostics.StackFrame[] sfs = st.GetFrames();
//		for (int u = 0; u < sfs.Length; ++u)
//		{
//			System.Reflection.MethodBase mb = sfs[u].GetMethod();
//			Debug.Log( u+ mb.DeclaringType.FullName+ mb.Name);
//		}
//		Transform t = null;
//				Transform tt = t.GetChild(0);
//		StackTrace stackTrace = new StackTrace(2,true);
//		Debug.Log(stackTrace.GetFrame(0).GetFileLineNumber());
//		MyLog.Log("sfhsjfhsfhs",gameObject);

//		string s = DESCrypto.Encrypt("你好 china", "12345678", "87654321");
//		Debug.LogError(s);
//		Debug.LogError(DESCrypto.Decrypt(s,"12345678", "87654321"));
//		Debug.Log(MD5Crypto.GetMD5_32("sssssss"));
//		
//		GameObject [] gameObjects = new GameObject[10];
//		gameObjects[1] = new GameObject("dsjd");
//		GameObject[] temp = gameObjects;
//		temp[1].name = "hhhhhhh";
//		Debug.Log(gameObjects[1].name);
		
//		gameObjects[1].name = gameObjects[1].name + "gfhdgfhdf";
//				Debug.Log(gameObjects[1].name);
		
		Dictionary<string,string> cmdDict = new Dictionary<string, string>();
		cmdDict.Add("1$%&","he$%&llo1");
		cmdDict.Add("11$%&","he$%&llo11");
		cmdDict.Add("111$%&","hell$%&o111");
		cmdDict.Add("1111$%&","hell$%&o1111");
		cmdDict.Add("11111$%&","hell$%&o11111");
		string sss = Json.Serialize(cmdDict);
		Debug.LogError(sss);

		MyClass ssd = new MyClass();
		ssd.age = 200;
		ssd.name = "dsjksjf 就是的快速";
		string ddd = JsonUtility.ToJson(ssd);
		Debug.LogError("ssssssss     "+ddd);

		Dictionary<string, object> qwqw = Json.Deserialize(sss) as Dictionary<string, object>;
		foreach (KeyValuePair<string, object> kvp in qwqw)
		{
			Debug.LogError("key : "+ kvp.Key+"  value :"+ kvp.Value);
		}
//		Debug.LogError("Time.deltaTime   "+Time.deltaTime);
//		Debug.LogError("Time.fixedTime   "+Time.fixedTime);
//		Debug.LogError("Time.fixedDeltaTime   "+Time.fixedDeltaTime);
//		Debug.LogError("Time.timeScale   "+Time.timeScale);
//		DateTime now = DateTime.Now;
//		Debug.LogError(now);
//		DateTime dateTime = new DateTime(1970, 1, 1);
//		DateTime ttt = dateTime.AddTicks((now.Ticks + 28800L) * 10000000L);
//		Debug.LogError(ttt);
		Debug.LogError("timedelatatine "+Time.deltaTime);
		Debug.LogError("timedelatatine *1000 f  "+Time.deltaTime*1000f);
		Debug.LogError("dbfhdsjf时间 " + (int)(Time.deltaTime*1000f));
		Singleton<TimeManager>.instance.AddTimer(10000, 1, onSettleMsgTimer);
//		var jsonString = "{ \"array\": [1.44,2,3], " +
//		                          "\"object\": {\"key1\":\"value1\", \"key2\":256}, " +
//		                          "\"string\": \"The quick brown fox \\\"jumps\\\" over the lazy dog \", " +
//		                          "\"unicode\": \"\\u3041 Men\u00fa sesi\u00f3n\", " +
//		                          "\"int\": 65536, " +
//		                          "\"float\": 3.1415926, " +
//		                          "\"bool\": true, " +
//		                          "\"null\": null }";
//		
//		          var dict = Json.Deserialize(jsonString) as Dictionary<string,object>;
//		
//		          Debug.Log("deserialized: " + dict.GetType());
//		          Debug.Log("dict['array'][0]: " + ((List<object>) dict["array"])[0]);
//		          Debug.Log("dict['string']: " + (string) dict["string"]);
//		          Debug.Log("dict['float']: " + (double) dict["float"]); // floats come out as doubles
//		          Debug.Log("dict['int']: " + (long) dict["int"]); // ints come out as longs
//		          Debug.Log("dict['unicode']: " + (string) dict["unicode"]);
//		
//		          var str = Json.Serialize(dict);
//		
//		          Debug.Log("serialized: " + str);
//		string configUrl = "http://apps.game.qq.com/cgi-bin/api/tplay/" + 1104466820 + "_cloud.cgi";
//		
//		Debug.Log
//			(configUrl);
//		Uri uri = new Uri(configUrl);
//		HttpWebRequest httpWebRequest = WebRequest.Create(configUrl) as HttpWebRequest;
//		httpWebRequest.Method = "POST";
//		
//		httpWebRequest.KeepAlive = true;
//		httpWebRequest.UserAgent = "Pandora(\"YXZJ-Android-V16\")";
//		httpWebRequest.Timeout = 20000;
//		HttpWebResponse httpWebResponse = httpWebRequest.GetResponse() as HttpWebResponse;

//		Stream responseStream = null;  
//		StreamReader sReader = null;  
//		String value = null;  
//		responseStream = httpWebResponse.GetResponseStream();  
//		// 对接响应流(以"utf-8"字符集)  
//		sReader = new StreamReader(responseStream);  
//		// 开始读取数据  
//		value = sReader.ReadToEnd();  
//		Debug.LogError(value);
//		string data =
//			"ewogICAiYWNjZXNzdG9rZW4iIDogIiIsCiAgICJhY2N0eXBlIiA6ICIiLAogICAiYWN0X3N3aXRjaCIgOiAiMCIsCiAgICJhcHBpZCIgOiAiIiwKICAgImFyZWFpZCIgOiAiIiwKICAgImJ1eVR5cGUiIDogIjAiLAogICAiY2FwX2lwMSIgOiAiIiwKICAgImNhcF9pcDIiIDogIiIsCiAgICJkZXBlbmRlbmN5IiA6ICIiLAogICAiZXJybXNnIiA6ICIgcGFyc2UgcG9zdCBkYXRhIGVycm9yIiwKICAgImZha2VMb2dpbkluZm8iIDogIiIsCiAgICJmbGFnIiA6ICIwIiwKICAgImZ1bmN0aW9uX3N3aXRjaCIgOiAiIiwKICAgImdhbWVhcHB2ZXJzaW9uIiA6ICIiLAogICAiaWQiIDogIjAiLAogICAiaXAiIDogIiIsCiAgICJpc0RlYnVnIiA6ICIwIiwKICAgImlzTmV0TG9nIiA6ICIwIiwKICAgImlzX3Nob3dfbG9nbyIgOiAiZmFsc2UiLAogICAibHVhX2NkbnVybCIgOiAiIiwKICAgImx1YV9uZXd2ZXJzaW9uIiA6ICIiLAogICAibHVhY19zX21kNSIgOiAiIiwKICAgImx1YXZlcnNpb24iIDogIiIsCiAgICJsdWNreV9zd2l0Y2giIDogIjAiLAogICAibWQ1IiA6ICIiLAogICAibWRzX29wIiA6ICIwIiwKICAgIm9wZW5pZCIgOiAiIiwKICAgInBhcnRpdGlvbmlkIiA6ICIiLAogICAicGxhdGlkIiA6ICIiLAogICAicG9ydCIgOiAiMCIsCiAgICJwcml2YXRlX3doaXRlbGlzdCIgOiAiIiwKICAgInB1bmNoZmFjZV9zd2l0Y2giIDogIjAiLAogICAicmF0ZSIgOiAiMCIsCiAgICJyZW1hcmsiIDogIiIsCiAgICJyZXByZXNlbnRtYXAiIDogIiIsCiAgICJyZXQiIDogIi0yMjAxMiIsCiAgICJzZGt2ZXJzaW9uIiA6ICIiLAogICAic2VydmVyaXAiIDogIjEwLjI0Ny4xMzEuMzMiLAogICAic29ydCIgOiAiIiwKICAgInNvdXJjZWxpc3QiIDogIiIsCiAgICJ0b3RhbFN3aXRjaCIgOiAiMCIsCiAgICJ6aXBfbWQ1IiA6ICIiCn0K";
//		byte[] encodedDataBytes = Convert.FromBase64String(data);
//		string text2 = MsdkTea.Decode(encodedDataBytes);
//		
//		if (text2.Length > 0)
//		{
//			Debug.LogError("");
//		}
		
		
		
	}
	
	// Update is called once per frame
	void Update () {
		
	}
	private void onSettleMsgTimer(int seq)
	{
	     Debug.LogError(DateTime.Now);
	}
}

class MyClass
{
	public  int age;
	public  string name;
}
